/********************************************************************************
*  This file is part of CinoLib                                                 *
*  Copyright(C) 2016: Marco Livesu                                              *
*                                                                               *
*  The MIT License                                                              *
*                                                                               *
*  Permission is hereby granted, free of charge, to any person obtaining a      *
*  copy of this software and associated documentation files (the "Software"),   *
*  to deal in the Software without restriction, including without limitation    *
*  the rights to use, copy, modify, merge, publish, distribute, sublicense,     *
*  and/or sell copies of the Software, and to permit persons to whom the        *
*  Software is furnished to do so, subject to the following conditions:         *
*                                                                               *
*  The above copyright notice and this permission notice shall be included in   *
*  all copies or substantial portions of the Software.                          *
*                                                                               *
*  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR   *
*  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,     *
*  FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE *
*  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER       *
*  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      *
*  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS *
*  IN THE SOFTWARE.                                                             *
*                                                                               *
*  Author(s):                                                                   *
*                                                                               *
*     Marco Livesu (marco.livesu@gmail.com)                                     *
*     http://pers.ge.imati.cnr.it/livesu/                                       *
*                                                                               *
*     Italian National Research Council (CNR)                                   *
*     Institute for Applied Mathematics and Information Technologies (IMATI)    *
*     Via de Marini, 6                                                          *
*     16149 Genoa,                                                              *
*     Italy                                                                     *
*********************************************************************************/
#ifndef CINO_SUBDIVISION_LEGACY_HEXA_SCHEMAS_H
#define CINO_SUBDIVISION_LEGACY_HEXA_SCHEMAS_H

#include <vector>
#include <sys/types.h>

// Points of the subdivided polygon/polyhedron will be defined as a linear combination of the
// initial vertices, according to the following structure:
//
// std::vector<                  => one entry for each new polygon/polyhedron in the new subdivided mesh
//      std::vector<             => one entry for each polygon/polyhedron vertex
//           std::vector<uint>>> => points of the input polygon/polyhedron that contribute to define
//                                  the vertex position (as a linear combination).
//                                  (NOTE: each entry contributes with 1/#entries. If a vertex wants to
//                                   contribute more, it'll appear multiple times. Say I want a new vertex
//                                   be defined as 3/4*v0 + 1/4*v1, the vector will be like: {0,0,0,1})

namespace cinolib
{

static const std::vector<std::vector<std::vector<uint>>> no_subdivision
{
    {{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}}
};

//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

static const std::vector<std::vector<std::vector<uint>>> hex_to_grid_2x2x2
{
    {{0}, {0,1}, {0,1,2,3}, {0,3}, {0,4}, {0,1,4,5}, {0,1,2,3,4,5,6,7}, {0,3,4,7}},
    {{0,1}, {1}, {1,2}, {0,1,2,3}, {0,1,4,5}, {1,5}, {1,2,5,6}, {0,1,2,3,4,5,6,7}},
    {{0,1,2,3}, {1,2}, {2}, {2,3}, {0,1,2,3,4,5,6,7}, {1,2,5,6}, {2,6}, {2,3,6,7}},
    {{0,3}, {0,1,2,3}, {2,3}, {3}, {0,3,4,7}, {0,1,2,3,4,5,6,7}, {2,3,6,7}, {3,7}},
    {{0,4}, {0,1,4,5}, {0,1,2,3,4,5,6,7}, {0,3,4,7}, {4}, {4,5}, {4,5,6,7}, {4,7}},
    {{0,1,4,5}, {1,5}, {1,2,5,6}, {0,1,2,3,4,5,6,7}, {4,5}, {5}, {5,6}, {4,5,6,7}},
    {{0,1,2,3,4,5,6,7}, {1,2,5,6}, {2,6}, {2,3,6,7}, {4,5,6,7}, {5,6}, {6}, {6,7}},
    {{0,3,4,7}, {0,1,2,3,4,5,6,7}, {2,3,6,7}, {3,7}, {4,7}, {4,5,6,7}, {6,7}, {7}}
};

//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

static const std::vector<std::vector<std::vector<uint>>> hex_to_grid_3x3x3
{
    {{0}, {0,0,1}, {0,0,2}, {0,0,3}, {0,0,4}, {0,0,5}, {0,0,2,0,0,2,4,4,6}, {0,0,7}},
    {{0,0,1}, {1,1,0}, {1,1,3}, {0,0,2}, {0,0,5}, {1,1,4}, {1,1,3,1,1,3,5,5,7}, {0,0,2,0,0,2,4,4,6}},
    {{1,1,0}, {1}, {1,1,2}, {1,1,3}, {1,1,4}, {1,1,5}, {1,1,6}, {1,1,3,1,1,3,5,5,7}},
    {{0,0,3}, {0,0,2}, {3,3,1}, {3,3,0}, {0,0,7}, {0,0,2,0,0,2,4,4,6}, {3,3,1,3,3,1,7,7,5}, {3,3,4}},
    {{0,0,2}, {1,1,3}, {2,2,0}, {3,3,1}, {0,0,2,0,0,2,4,4,6}, {1,1,3,1,1,3,5,5,7}, {2,2,0,2,2,0,6,6,4}, {3,3,1,3,3,1,7,7,5}},
    {{1,1,3}, {1,1,2}, {2,2,1}, {2,2,0}, {1,1,3,1,1,3,5,5,7}, {1,1,6}, {2,2,5}, {2,2,0,2,2,0,6,6,4}},
    {{3,3,0}, {3,3,1}, {3,3,2}, {3}, {3,3,4}, {3,3,1,3,3,1,7,7,5}, {3,3,6}, {3,3,7}},
    {{3,3,1}, {2,2,0}, {2,2,3}, {3,3,2}, {3,3,1,3,3,1,7,7,5}, {2,2,0,2,2,0,6,6,4}, {2,2,7}, {3,3,6}},
    {{2,2,0}, {2,2,1}, {2}, {2,2,3}, {2,2,0,2,2,0,6,6,4}, {2,2,5}, {2,2,6}, {2,2,7}},
    {{0,0,4}, {0,0,5}, {0,0,2,0,0,2,4,4,6}, {0,0,7}, {0,4,4}, {4,4,1}, {0,0,2,4,4,6,4,4,6}, {4,4,3}},
    {{0,0,5}, {1,1,4}, {1,1,3,1,1,3,5,5,7}, {0,0,2,0,0,2,4,4,6}, {4,4,1}, {5,5,0}, {1,1,3,5,5,7,5,5,7}, {0,0,2,4,4,6,4,4,6}},
    {{1,1,4}, {1,1,5}, {1,1,6}, {1,1,3,1,1,3,5,5,7}, {5,5,0}, {1,5,5,}, {5,5,2}, {1,1,3,5,5,7,5,5,7}},
    {{0,0,7}, {0,0,2,0,0,2,4,4,6}, {3,3,1,3,3,1,7,7,5}, {3,3,4}, {4,4,3}, {0,0,2,4,4,6,4,4,6}, {3,3,1,7,7,5,7,7,5}, {7,7,0}},
    {{0,0,2,0,0,2,4,4,6}, {1,1,3,1,1,3,5,5,7}, {2,2,0,2,2,0,6,6,4}, {3,3,1,3,3,1,7,7,5}, {0,0,2,4,4,6,4,4,6}, {1,1,3,5,5,7,5,5,7}, {2,2,0,6,6,4,6,6,4}, {3,3,1,7,7,5,7,7,5}},
    {{1,1,3,1,1,3,5,5,7}, {1,1,6}, {2,2,5}, {2,2,0,2,2,0,6,6,4}, {1,1,3,5,5,7,5,5,7}, {5,5,2}, {6,6,1}, {2,2,0,6,6,4,6,6,4}},
    {{3,3,4}, {3,3,1,3,3,1,7,7,5}, {3,3,6}, {3,3,7}, {7,7,0}, {3,3,1,7,7,5,7,7,5}, {7,7,2}, {3,7,7}},
    {{3,3,1,3,3,1,7,7,5}, {2,2,0,2,2,0,6,6,4}, {2,2,7}, {3,3,6}, {3,3,1,7,7,5,7,7,5}, {2,2,0,6,6,4,6,6,4}, {6,6,3}, {7,7,2}},
    {{2,2,0,2,2,0,6,6,4}, {2,2,5}, {2,2,6}, {2,2,7}, {2,2,0,6,6,4,6,6,4}, {6,6,1}, {2,6,6}, {6,6,3}},
    {{0,4,4}, {4,4,1}, {0,0,2,4,4,6,4,4,6}, {4,4,3}, {4}, {4,4,5}, {4,4,6}, {4,4,7}},
    {{4,4,1}, {5,5,0}, {1,1,3,5,5,7,5,5,7}, {0,0,2,4,4,6,4,4,6}, {4,4,5}, {5,5,4}, {5,5,7}, {4,4,6}},
    {{5,5,0}, {1,5,5}, {5,5,2}, {1,1,3,5,5,7,5,5,7}, {5,5,4}, {5}, {5,5,6}, {5,5,7}},
    {{4,4,3}, {0,0,2,4,4,6,4,4,6}, {3,3,1,7,7,5,7,7,5}, {7,7,0}, {4,4,7}, {4,4,6}, {7,7,5}, {7,7,4}},
    {{0,0,2,4,4,6,4,4,6}, {1,1,3,5,5,7,5,5,7}, {2,2,0,6,6,4,6,6,4}, {3,3,1,7,7,5,7,7,5}, {4,4,6}, {5,5,7}, {6,6,4}, {7,7,5}},
    {{1,1,3,5,5,7,5,5,7}, {5,5,2}, {6,6,1}, {2,2,0,6,6,4,6,6,4}, {5,5,7}, {5,5,6}, {6,6,5}, {6,6,4}},
    {{7,7,0}, {3,3,1,7,7,5,7,7,5}, {7,7,2}, {3,7,7}, {7,7,4}, {7,7,5}, {7,7,6}, {7}},
    {{3,3,1,7,7,5,7,7,5}, {2,2,0,6,6,4,6,6,4}, {6,6,3}, {7,7,2}, {7,7,5}, {6,6,4}, {6,6,7}, {7,7,6}},
    {{2,2,0,6,6,4,6,6,4}, {6,6,1}, {2,6,6}, {6,6,3}, {6,6,4}, {6,6,5}, {6}, {6,6,7}},
};

//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

static const std::vector<std::vector<std::vector<uint>>> hex_to_grid_4x4x4
{
    {{0}, {0,0,0,1}, {0,0,0,2}, {0,0,0,3}, {0,0,0,4}, {0,0,0,5}, {0,0,0,6}, {0,0,0,7}}, //0ok
    {{0,0,0,1}, {0,1}, {0,0,0,1,1,1,2,3}, {0,0,0,2}, {0,0,0,5}, {0,0,0,1,1,1,4,5}, {0,0,0,0,0,1,1,1,1,1,2,3,4,5,6,7}, {0,0,0,6}}, //1ok
    {{0,1}, {0,1,1,1}, {1,1,1,3}, {0,0,0,1,1,1,2,3}, {0,0,0,1,1,1,4,5}, {1,1,1,4}, {1,1,1,7}, {0,0,0,0,0,1,1,1,1,1,2,3,4,5,6,7}}, //2ok
    {{0,1,1,1}, {1}, {1,1,1,2}, {1,1,1,3}, {1,1,1,4}, {1,1,1,5}, {1,1,1,6}, {1,1,1,7}}, //3ok
    {{0,0,0,3}, {0,0,0,2}, {0,0,0,1,2,3,3,3}, {0,3}, {0,0,0,7}, {0,0,0,6}, {0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,2,2}, {0,2,2,2}, {0,1,2,3,4,5,6,7,1,2,1,2,1,2,1,2}, {1,2,5,6,1,2,1,2}, {2,2,2,5}, {2,2,2,4}}, //11
    {{3,3,3,0}, {3,3,3,1}, {2,3,3,3}, {3}, {3,3,3,4}, {3,3,3,5}, {3,3,3,6}, {3,3,3,7}}, //12
    {{3,3,3,1}, {0,1,2,2,2,3,3,3}, {2,3}, {2,3,3,3}, {3,3,3,5}, {0,1,2,2,2,2,2,3,3,3,3,3,4,5,6,7}, {2,2,2,3,3,3,6,7}, {3,3,3,6}}, //13
    {{0,1,2,2,2,3,3,3}, {0,2,2,2}, {2,2,2,3}, {2,3}, {0,1,2,2,2,2,2,3,3,3,3,3,4,5,6,7}, {2,2,2,4}, {2,2,2,7}, {2,2,2,3,3,3,6,7}}, //14
    {{0,2,2,2}, {1,2,2,2}, {2}, {2,2,2,3}, {2,2,2,4}, {2,2,2,5}, {2,2,2,6}, {2,2,2,7}}, //15
    {{0,0,0,4}, {0,0,0,5}, {0,0,0,6}, {0,0,0,7}, {0,4}, {0,4,0,4,0,1,4,5}, {0,1,2,3,4,5,6,7,0,4,0,4,0,4,0,4}, {0,3,4,7,0,4,0,4}}, //16
    {{0,0,0,5}, {0,0,0,1,1,1,4,5}, {0,0,0,0,0,1,1,1,1,1,2,3,4,5,6,7}, {0,0,0,6}, {0,4,0,4,0,1,4,5}, {0,1,4,5}, {0,1,2,3,4,5,6,7,0,1,4,5,0,1,4,5}, {0,1,2,3,4,5,6,7,0,4,0,4,0,4,0,4}}, //17
    {{0,0,0,1,1,1,4,5}, {1,1,1,4}, {1,1,1,7}, {0,0,0,0,0,1,1,1,1,1,2,3,4,5,6,7}, {0,1,4,5}, {1,5,1,5,0,1,4,5}, {0,1,2,3,4,5,6,7,1,5,1,5,1,5,1,5}, {0,1,2,3,4,5,6,7,0,1,4,5,0,1,4,5}}, //18
    {{1,1,1,4}, {1,1,1,5}, {1,1,1,6}, {1,1,1,7}, {1,5,1,5,0,1,4,5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}, {3,6,6,6}}, //47
    {{0,4,4,4}, {1,4,4,4}, {2,4,4,4}, {3,4,4,4}, {4}, {4,4,4,5}, {4,4,4,6}, {4,4,4,7}}, //48
    {{1,4,4,4}, {0,1,4,5,4,5,4,5}, {0,1,2,3,4,5,6,7,4,5,4,5,4,5,4,5}, {2,4,4,4}, {4,4,4,5}, {4,5}, {4,5,6,7,4,5,4,5}, {4,4,4,6}}, //49
    {{0,1,4,5,4,5,4,5}, {0,5,5,5}, {3,5,5,5}, {0,1,2,3,4,5,6,7,4,5,4,5,4,5,4,5}, {4,5}, {4,5,5,5}, {5,5,5,7}, {4,5,6,7,4,5,4,5}}, //50
    {{0,5,5,5}, {1,5,5,5}, {2,5,5,5}, {3,5,5,5}, {4,5,5,5}, {5}, {5,5,5,6}, {5,5,5,7}}, //51
    {{3,4,4,4}, {2,4,4,4}, {4,7,4,7,4,7,4,7,0,1,2,3,4,5,6,7}, {4,7,4,7,0,3,4,7}, {4,4,4,7}, {4,4,4,6}, {4,5,6,7,4,7,4,7}, {4,7}}, //52
    {{2,4,4,4}, {0,1,2,3,4,5,6,7,4,5,4,5,4,5,4,5}, {0,1,2,3,4,5,6,7,4,5,6,7,4,5,6,7}, {4,7,4,7,4,7,4,7,0,1,2,3,4,5,6,7}, {4,4,4,6}, {4,5,6,7,4,5,4,5}, {4,5,6,7}, {4,5,6,7,4,7,4,7}}, //53
    {{0,1,2,3,4,5,6,7,4,5,4,5,4,5,4,5}, {3,5,5,5}, {0,1,2,3,4,5,6,7,5,6,5,6,5,6,5,6}, {0,1,2,3,4,5,6,7,4,5,6,7,4,5,6,7}, {4,5,6,7,4,5,4,5}, {5,5,5,7}, {4,5,6,7,5,6,5,6}, {4,5,6,7}}, //54
    {{3,5,5,5}, {2,5,5,5}, {1,2,5,6,5,6,5,6}, {0,1,2,3,4,5,6,7,5,6,5,6,5,6,5,6}, {5,5,5,7}, {5,5,5,6}, {5,6}, {4,5,6,7,5,6,5,6}}, //55
    {{4,7,4,7,0,3,4,7}, {4,7,4,7,4,7,4,7,0,1,2,3,4,5,6,7}, {1,7,7,7}, {0,7,7,7}, {4,7}, {4,5,6,7,4,7,4,7}, {5,7,7,7}, {4,7,7,7}}, //56
    {{4,7,4,7,4,7,4,7,0,1,2,3,4,5,6,7}, {0,1,2,3,4,5,6,7,4,5,6,7,4,5,6,7}, {0,1,2,3,4,5,6,7,6,7,6,7,6,7,6,7}, {1,7,7,7}, {4,5,6,7,4,7,4,7}, {4,5,6,7}, {4,5,6,7,6,7,6,7}, {5,7,7,7}}, //57
    {{0,1,2,3,4,5,6,7,4,5,6,7,4,5,6,7}, {0,1,2,3,4,5,6,7,5,6,5,6,5,6,5,6}, {0,6,6,6}, {0,1,2,3,4,5,6,7,6,7,6,7,6,7,6,7}, {4,5,6,7}, {4,5,6,7,5,6,5,6}, {4,6,6,6}, {4,5,6,7,6,7,6,7}}, //58
    {{0,1,2,3,4,5,6,7,5,6,5,6,5,6,5,6}, {1,2,5,6,5,6,5,6}, {1,6,6,6}, {0,6,6,6}, {4,5,6,7,5,6,5,6}, {5,6}, {5,6,6,6}, {4,6,6,6}}, //59
    {{0,7,7,7}, {1,7,7,7}, {2,7,7,7}, {3,7,7,7}, {4,7,7,7}, {5,7,7,7}, {6,7,7,7}, {7}}, //60
    {{1,7,7,7}, {0,1,2,3,4,5,6,7,6,7,6,7,6,7,6,7}, {2,3,6,7,6,7,6,7}, {2,7,7,7}, {5,7,7,7}, {4,5,6,7,6,7,6,7}, {6,7}, {6,7,7,7}}, //61
    {{0,1,2,3,4,5,6,7,6,7,6,7,6,7,6,7}, {0,6,6,6}, {3,6,6,6}, {2,3,6,7,6,7,6,7}, {4,5,6,7,6,7,6,7}, {4,6,6,6}, {6,6,6,7}, {6,7}}, //62
    {{0,6,6,6}, {1,6,6,6}, {2,6,6,6}, {3,6,6,6}, {4,6,6,6}, {5,6,6,6}, {6}, {6,6,6,7}} //63
};

//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

static const std::vector<std::vector<std::vector<uint>>> hex_to_grid_4x4x4_old
{
    {{0}, {0,0,0,1}, {0,0,0,2}, {0,0,0,3}, {0,0,0,4}, {0,0,0,5}, {0,0,0,6}, {0,0,0,7}}, //0ok
    {{0,0,0,1}, {0,1}, {0,0,1,2}, {0,0,0,2}, {0,0,0,5}, {0,0,1,5}, {0,0,1,6}, {0,0,0,6}}, //1ok
    {{0,1}, {0,1,1,1}, {1,1,1,3}, {0,0,1,2}, {0,0,1,5}, {1,1,1,4}, {1,1,1,7}, {0,0,1,6}}, //2ok
    {{0,1,1,1}, {1}, {1,1,1,2}, {1,1,1,3}, {1,1,1,4}, {1,1,1,5}, {1,1,1,6}, {1,1,1,7}}, //3ok
    {{0,0,0,3}, {0,0,0,2}, {0,0,2,3}, {0,3}, {0,0,0,7}, {0,0,0,6}, {0,0,3,6}, {0,0,3,7}}, //4
    {{0,0,0,2}, {0,0,1,2}, {0,2}, {0,0,2,3}, {0,0,0,6}, {0,0,1,6}, {0,0,2,6}, {0,0,3,6}}, //5
    {{0,0,1,2}, {1,1,1,3}, {1,1,2,3}, {0,2}, {0,0,1,6}, {1,1,1,7}, {1,2,2,4}, {0,0,2,6}}, //6
    {{1,1,1,3}, {1,1,1,2}, {1,2}, {1,1,2,3}, {1,1,1,7}, {1,1,1,6}, {1,1,2,6}, {1,2,2,4}}, //7
    {{0,3}, {0,0,2,3}, {3,3,3,1}, {3,3,3,0}, {0,0,3,7}, {0,0,3,6}, {3,3,3,5}, {3,3,3,4}}, //8
    {{0,0,2,3}, {0,2}, {0,2,2,3}, {3,3,3,1}, {0,0,3,6}, {0,0,2,6}, {2,2,3,4}, {3,3,3,5}}, //9
    {{0,2}, {1,1,2,3}, {0,2,2,2}, {0,2,2,3}, {0,0,2,6}, {1,2,2,4}, {2,2,2,4}, {2,2,3,4}}, //10
    {{1,1,2,3}, {1,2}, {1,2,2,2}, {0,2,2,2}, {1,2,2,4}, {1,1,2,6}, {2,2,2,5}, {2,2,2,4}}, //11
    {{3,3,3,0}, {3,3,3,1}, {2,3,3,3}, {3}, {3,3,3,4}, {3,3,3,5}, {3,3,3,6}, {3,3,3,7}}, //12
    {{3,3,3,1}, {0,2,2,3}, {2,3}, {2,3,3,3}, {3,3,3,5}, {2,2,3,4}, {2,2,3,7}, {3,3,3,6}}, //13
    {{0,2,2,3}, {0,2,2,2}, {2,2,2,3}, {2,3}, {2,2,3,4}, {2,2,2,4}, {2,2,2,7}, {2,2,3,7}}, //14
    {{0,2,2,2}, {1,2,2,2}, {2}, {2,2,2,3}, {2,2,2,4}, {2,2,2,5}, {2,2,2,6}, {2,2,2,7}}, //15
    {{0,0,0,4}, {0,0,0,5}, {0,0,0,6}, {0,0,0,7}, {0,4}, {0,0,4,5}, {0,0,4,6}, {0,0,4,7}}, //16
    {{0,0,0,5}, {0,0,1,5}, {0,0,1,6}, {0,0,0,6}, {0,0,4,5}, {0,5}, {0,0,5,6}, {0,0,4,6}}, //17
    {{0,0,1,5}, {1,1,1,4}, {1,1,1,7}, {0,0,1,6}, {0,5}, {1,1,4,5}, {1,1,5,7}, {0,0,5,6}}, //18
    {{1,1,1,4}, {1,1,1,5}, {1,1,1,6}, {1,1,1,7}, {1,1,4,5}, {1,5}, {1,1,5,6}, {1,1,5,7}}, //19
    {{0,0,0,7}, {0,0,0,6}, {0,0,3,6}, {0,0,3,7}, {0,0,4,7}, {0,0,4,6}, {0,0,6,7}, {0,7}}, //20
    {{0,0,0,6}, {0,0,1,6}, {0,0,2,6}, {0,0,3,6}, {0,0,4,6}, {0,0,5,6}, {0,6}, {0,0,6,7}}, //21
    {{0,0,1,6}, {1,1,1,7}, {1,2,2,4}, {0,0,2,6}, {0,0,5,6}, {1,1,5,7}, {1,1,6,7}, {0,6}}, //22
    {{1,1,1,7}, {1,1,1,6}, {1,1,2,6}, {1,2,2,4}, {1,1,5,7}, {1,1,5,6}, {1,6}, {1,1,6,7}}, //23
    {{0,0,3,7}, {0,0,3,6}, {3,3,3,5}, {3,3,3,4}, {0,7}, {0,0,6,7}, {3,3,5,7}, {3,3,4,7}}, //24
    {{0,0,3,6}, {0,0,2,6}, {2,2,3,4}, {3,3,3,5}, {0,0,6,7}, {0,6}, {2,2,4,7}, {3,3,5,7}}, //25
    {{0,0,2,6}, {1,2,2,4}, {2,2,2,4}, {2,2,3,4}, {0,6}, {1,1,6,7}, {2,2,4,6}, {2,2,4,7}}, //26
    {{1,2,2,4}, {1,1,2,6}, {2,2,2,5}, {2,2,2,4}, {1,1,6,7}, {1,6}, {2,2,5,6}, {2,2,4,6}}, //27
    {{3,3,3,4}, {3,3,3,5}, {3,3,3,6}, {3,3,3,7}, {3,3,4,7}, {3,3,5,7}, {3,3,6,7}, {3,7}}, //28
    {{3,3,3,5}, {2,2,3,4}, {2,2,3,7}, {3,3,3,6}, {3,3,5,7}, {2,2,4,7}, {3,6}, {3,3,6,7}}, //29
    {{2,2,3,4}, {2,2,2,4}, {2,2,2,7}, {2,2,3,7}, {2,2,4,7}, {2,2,4,6}, {2,2,6,7}, {3,6}}, //30
    {{2,2,2,4}, {2,2,2,5}, {2,2,2,6}, {2,2,2,7}, {2,2,4,6}, {2,2,5,6}, {2,6}, {2,2,6,7}}, //31
    {{0,4}, {0,0,4,5}, {0,0,4,6}, {0,0,4,7}, {0,4,4,4}, {1,4,4,4}, {2,4,4,4}, {3,4,4,4}}, //32
    {{0,0,4,5}, {0,5}, {0,0,5,6}, {0,0,4,6}, {1,4,4,4}, {1,4,4,5}, {2,4,4,5}, {2,4,4,4}}, //33
    {{0,5}, {1,1,4,5}, {1,1,5,7}, {0,0,5,6}, {1,4,4,5}, {0,5,5,5}, {3,5,5,5}, {2,4,4,5}}, //34
    {{1,1,4,5}, {1,5}, {1,1,5,6}, {1,1,5,7}, {0,5,5,5}, {1,5,5,5}, {2,5,5,5}, {3,5,5,5}}, //35
    {{0,0,4,7}, {0,0,4,6}, {0,0,6,7}, {0,7}, {3,4,4,4}, {2,4,4,4}, {2,4,4,7}, {3,4,4,7}}, //36
    {{0,0,4,6}, {0,0,5,6}, {0,6}, {0,0,6,7}, {2,4,4,4}, {2,4,4,5}, {2,4,4,6}, {2,4,4,7}}, //37
    {{0,0,5,6}, {1,1,5,7}, {1,1,6,7}, {0,6}, {2,4,4,5}, {3,5,5,5}, {3,5,5,6}, {2,4,4,6}}, //38
    {{1,1,5,7}, {1,1,5,6}, {1,6}, {1,1,6,7}, {3,5,5,5}, {2,5,5,5}, {2,5,5,6}, {3,5,5,6}}, //39
    {{0,7}, {0,0,6,7}, {3,3,5,7}, {3,3,4,7}, {3,4,4,7}, {2,4,4,7}, {1,7,7,7}, {0,7,7,7}}, //40
    {{0,0,6,7}, {0,6}, {2,2,4,7}, {3,3,5,7}, {2,4,4,7}, {2,4,4,6}, {1,6,7,7}, {1,7,7,7}}, //41
    {{0,6}, {1,1,6,7}, {2,2,4,6}, {2,2,4,7}, {2,4,4,6}, {3,5,5,6}, {0,6,6,6}, {1,6,7,7}}, //42
    {{1,1,6,7}, {1,6}, {2,2,5,6}, {2,2,4,6}, {3,5,5,6}, {2,5,5,6}, {1,6,6,6}, {0,6,6,6}}, //43
    {{3,3,4,7}, {3,3,5,7}, {3,3,6,7}, {3,7}, {0,7,7,7}, {1,7,7,7}, {2,7,7,7}, {3,7,7,7}}, //44
    {{3,3,5,7}, {2,2,4,7}, {3,6}, {3,3,6,7}, {1,7,7,7}, {1,6,7,7}, {2,6,7,7}, {2,7,7,7}}, //45
    {{2,2,4,7}, {2,2,4,6}, {2,2,6,7}, {3,6}, {1,6,7,7}, {0,6,6,6}, {3,6,6,6}, {2,6,7,7}}, //46
    {{2,2,4,6}, {2,2,5,6}, {2,6}, {2,2,6,7}, {0,6,6,6}, {1,6,6,6}, {2,6,6,6}, {3,6,6,6}}, //47
    {{0,4,4,4}, {1,4,4,4}, {2,4,4,4}, {3,4,4,4}, {4}, {4,4,4,5}, {4,4,4,6}, {4,4,4,7}}, //48
    {{1,4,4,4}, {1,4,4,5}, {2,4,4,5}, {2,4,4,4}, {4,4,4,5}, {4,5}, {4,4,5,6}, {4,4,4,6}}, //49
    {{1,4,4,5}, {0,5,5,5}, {3,5,5,5}, {2,4,4,5}, {4,5}, {4,5,5,5}, {5,5,5,7}, {4,4,5,6}}, //50
    {{0,5,5,5}, {1,5,5,5}, {2,5,5,5}, {3,5,5,5}, {4,5,5,5}, {5}, {5,5,5,6}, {5,5,5,7}}, //51
    {{3,4,4,4}, {2,4,4,4}, {2,4,4,7}, {3,4,4,7}, {4,4,4,7}, {4,4,4,6}, {4,4,6,7}, {4,7}}, //52
    {{2,4,4,4}, {2,4,4,5}, {2,4,4,6}, {2,4,4,7}, {4,4,4,6}, {4,4,5,6}, {4,6}, {4,4,6,7}}, //53
    {{2,4,4,5}, {3,5,5,5}, {3,5,5,6}, {2,4,4,6}, {4,4,5,6}, {5,5,5,7}, {4,5,6,6}, {4,6}}, //54
    {{3,5,5,5}, {2,5,5,5}, {2,5,5,6}, {3,5,5,6}, {5,5,5,7}, {5,5,5,6}, {5,6}, {4,5,6,6}}, //55
    {{3,4,4,7}, {2,4,4,7}, {1,7,7,7}, {0,7,7,7}, {4,7}, {4,4,6,7}, {5,7,7,7}, {4,7,7,7}}, //56
    {{2,4,4,7}, {2,4,4,6}, {1,6,7,7}, {1,7,7,7}, {4,4,6,7}, {4,6}, {5,6,7,7}, {5,7,7,7}}, //57
    {{2,4,4,6}, {3,5,5,6}, {0,6,6,6}, {1,6,7,7}, {4,6}, {4,5,6,6}, {4,6,6,6}, {5,6,7,7}}, //58
    {{3,5,5,6}, {2,5,5,6}, {1,6,6,6}, {0,6,6,6}, {4,5,6,6}, {5,6}, {5,6,6,6}, {4,6,6,6}}, //59
    {{0,7,7,7}, {1,7,7,7}, {2,7,7,7}, {3,7,7,7}, {4,7,7,7}, {5,7,7,7}, {6,7,7,7}, {7}}, //60
    {{1,7,7,7}, {1,6,7,7}, {2,6,7,7}, {2,7,7,7}, {5,7,7,7}, {5,6,7,7}, {6,7}, {6,7,7,7}}, //61
    {{1,6,7,7}, {0,6,6,6}, {3,6,6,6}, {2,6,7,7}, {5,6,7,7}, {4,6,6,6}, {6,6,6,7}, {6,7}}, //62
    {{0,6,6,6}, {1,6,6,6}, {2,6,6,6}, {3,6,6,6}, {4,6,6,6}, {5,6,6,6}, {6}, {6,6,6,7}} //63
};

//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

static const std::vector<std::vector<std::vector<uint>>> hex_to_cone_1x1_to_2x2
{
    {{0,1}, {1}, {1,2}, {0,1,2,3}, {0,0,0,1,1,1,4,5}, {1,1,1,5}, {1,1,1,2,2,2,6,5}, {0,0,0,1,1,1,2,2,2,3,3,3,4,5,6,7}},
    {{0}, {0,1}, {0,1,2,3}, {0,3}, {0,4}, {0,0,0,1,1,1,4,5}, {0,0,0,1,1,1,2,2,2,3,3,3,4,5,6,7}, {0,3,4,7}},
    {{0,3}, {0,1,2,3}, {2,3}, {3}, {0,4,7,3}, {0,0,0,1,1,1,2,2,2,3,3,3,4,5,6,7}, {2,2,2,3,3,3,6,7}, {3,7}},
    {{0,1,2,3}, {1,2}, {2}, {2,3}, {0,0,0,1,1,1,2,2,2,3,3,3,4,5,6,7}, {1,1,1,2,2,2,5,6}, {2,2,2,6}, {2,2,2,3,3,3,6,7}},
    {{0,0,0,1,1,1,2,2,2,3,3,3,4,5,6,7}, {1,1,1,2,2,2,5,6}, {2,2,2,6}, {2,2,2,3,3,3,6,7}, {0,3,4,7}, {1,2,5,6}, {2,6}, {3,7}},
    {{0,0,0,1,1,1,4,5}, {1,1,1,5}, {1,1,1,2,2,2,6,5}, {0,0,0,1,1,1,2,2,2,3,3,3,4,5,6,7}, {0,4}, {1,5}, {1,2,5,6}, {0,3,4,7}},
    {{0,4}, {1,5}, {1,2,5,6}, {0,3,4,7}, {4}, {5}, {5,5,5,6,6,6,1,2}, {4,4,4,7,7,7,0,3}},
    {{0,3,4,7}, {1,2,5,6}, {6,2}, {7,3}, {4,4,4,7,7,7,0,3}, {5,5,5,6,6,6,1,2}, {6,6,6,2}, {7,7,7,3}},
    {{4,4,4,7,7,7,0,3}, {5,5,5,6,6,6,1,2}, {6,6,6,2}, {7,7,7,3}, {4}, {5}, {6}, {7}}
};

//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

static const std::vector<std::vector<std::vector<uint>>> hex_to_cone_1x1_to_3x3
{
    {{0}, {0,0,1}, {0,0,2}, {0,0,3}, {0,4}, {0,0,1,0,0,1,0,0,1,4,4,5}, {0,0,2,0,0,2,0,0,2,4,4,6}, {0,0,3,4,4,7}},
    {{0,0,3}, {0,0,2}, {3,3,1}, {3,3,0}, {0,0,3,4,4,7}, {0,0,2,0,0,2,0,0,2,4,4,6}, {3,3,1,3,3,1,3,3,1,7,7,5}, {3,3,0,7,7,4}},
    {{3,3,0}, {3,3,1}, {3,3,2}, {3}, {3,3,0,7,7,4}, {3,3,1,3,3,1,3,3,1,7,7,5}, {3,3,2,3,3,2,3,3,2,7,7,6}, {3,7}},
    {{0,0,1}, {1,1,0}, {1,1,3}, {0,0,2}, {0,0,1,0,0,1,0,0,1,4,4,5}, {1,1,0,1,1,0,1,1,0,5,5,4}, {1,1,3,1,1,3,1,1,3,5,5,7}, {0,0,2,0,0,2,0,0,2,4,4,6}},
    {{0,0,2}, {1,1,3}, {2,2,0}, {3,3,1}, {0,0,2,0,0,2,0,0,2,4,4,6}, {1,1,3,1,1,3,1,1,3,5,5,7}, {2,2,0,2,2,0,2,2,0,6,6,4}, {3,3,1,3,3,1,3,3,1,7,7,5}},
    {{3,3,1}, {2,2,0}, {3,2,2}, {3,3,2}, {3,3,1,3,3,1,3,3,1,7,7,5}, {2,2,0,2,2,0,2,2,0,6,6,4}, {2,2,3,2,2,3,2,2,3,6,6,7}, {3,3,2,3,3,2,3,3,2,7,7,6}},
    {{0,1,1}, {1}, {1,1,2}, {1,1,3}, {0,1,1,0,1,1,0,1,1,4,5,5}, {1,5}, {1,1,2,5,5,6}, {1,1,3,1,1,3,1,1,3,5,5,7}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6,6,5,6,6,5}, {6}, {7}},
    {{0,0,3,4,4,7,4,4,7,4,4,7}, {1,1,2,5,5,6,5,5,6,5,5,6}, {2,2,1,6,6,5,6,6,5,6,6,5}, {3,3,0,7,7,4,7,7,4,7,7,4}, {4}, {5}, {6}, {7}}
};

//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

static const std::vector<std::vector<std::vector<uint>>> hex_to_cone_2x2_to_4x4
{
    {{0}, {0,0,0,1}, {0,0,0,2}, {0,0,0,3}, {0,0,0,4}, {0,0,0,5}, {0,0,0,6}, {0,0,0,7}}, //0ok
    {{0,0,0,1}, {0,1}, {0,0,0,1,1,1,2,3}, {0,0,0,2}, {0,0,0,5}, {0,0,0,1,1,1,4,5}, {0,0,0,0,0,1,1,1,1,1,2,3,4,5,6,7}, {0,0,0,6}}, //1ok
    {{0,1}, {0,1,1,1}, {1,1,1,3}, {0,0,0,1,1,1,2,3}, {0,0,0,1,1,1,4,5}, {1,1,1,4}, {1,1,1,7}, {0,0,0,0,0,1,1,1,1,1,2,3,4,5,6,7}}, //2ok
    {{0,1,1,1}, {1}, {1,1,1,2}, {1,1,1,3}, {1,1,1,4}, {1,1,1,5}, {1,1,1,6}, {1,1,1,7}}, //3ok
    {{0,3,3,3}, {1,3,3,3}, {2,3,3,3}, {3}, {3,3,3,4}, {3,3,3,5}, {3,3,3,6}, {3,3,3,7}}, //4ok
    {{1,3,3,3}, {0,1,2,2,2,3,3,3}, {2,3}, {2,3,3,3}, {3,3,3,5}, {0,1,2,2,2,2,2,3,3,3,3,3,4,5,6,7}, {2,2,2,3,3,3,6,7}, {3,3,3,6}}, //5ok
    {{0,1,2,2,2,3,3,3}, {0,2,2,2}, {2,2,2,3}, {2,3}, {0,1,2,2,2,2,2,3,3,3,3,3,4,5,6,7}, {2,2,2,4}, {2,2,2,7}, {2,2,2,3,3,3,6,7}}, //6ok
    {{0,2,2,2}, {1,2,2,2}, {2}, {2,2,2,3}, {2,2,2,4}, {2,2,2,5}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7,2,3,6,7,2,3,6,7,6,6,7,7}, {2,7,7,7}, {4,5,6,7}, {0,1,2,3,4,5,6,7,5,6,5,6,5,6,5,6}, {3,6,6,6}, {6,7}}, //37
    {{0,4,4,4}, {1,4,4,4}, {4,7,4,7,4,7,4,7,0,1,2,3,4,5,6,7}, {4,7,4,7,0,3,4,7}, {4}, {4,5}, {4,5,6,7}, {4,7}}, //38
    {{0,5,5,5}, {1,5,5,5}, {1,2,5,6,5,6,5,6}, {0,1,2,3,4,5,6,7,5,6,5,6,5,6,5,6}, {4,5}, {5}, {5,6}, {4,5,6,7}}, //39
    {{4,7,4,7,0,3,4,7}, {4,7,4,7,4,7,4,7,0,1,2,3,4,5,6,7}, {2,7,7,7}, {3,7,7,7}, {4,7}, {4,5,6,7}, {6,7}, {7}}, //40
    {{0,1,2,3,4,5,6,7,5,6,5,6,5,6,5,6}, {1,2,5,6,5,6,5,6}, {2,6,6,6}, {3,6,6,6}, {4,5,6,7}, {5,6}, {6}, {6,7}}  //41
};

//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

static const std::vector<std::vector<std::vector<uint>>> hex_to_cone_2x2_to_4x4_old
{
    {{0}, {0,0,0,1}, {0,0,0,2}, {0,0,0,3}, {0,0,0,4}, {0,0,0,5}, {0,0,0,6}, {0,0,0,7}}, //0ok
    {{0,0,0,1}, {0,1}, {0,0,1,2}, {0,0,0,2}, {0,0,0,5}, {0,0,1,5}, {0,0,1,6}, {0,0,0,6}}, //1
    {{0,1}, {0,1,1,1}, {1,1,1,3}, {0,0,1,2}, {0,0,1,5}, {1,1,1,4}, {1,1,1,7}, {0,0,1,6}}, //2
    {{0,1,1,1}, {1}, {1,1,1,2}, {1,1,1,3}, {1,1,1,4}, {1,1,1,5}, {1,1,1,6}, {1,1,1,7}}, //3
    {{0,3,3,3}, {1,3,3,3}, {2,3,3,3}, {3}, {3,3,3,4}, {3,3,3,5}, {3,3,3,6}, {3,3,3,7}}, //4
    {{1,3,3,3}, {0,2,2,3}, {2,3}, {2,3,3,3}, {3,3,3,5}, {2,2,3,4}, {2,2,3,7}, {3,3,3,6}}, //5
    {{0,2,2,3}, {0,2,2,2}, {2,2,2,3}, {2,3}, {2,2,3,4}, {2,2,2,4}, {2,2,2,7}, {2,2,3,7}}, //6
    {{0,2,2,2}, {1,2,2,2}, {2}, {2,2,2,3}, {2,2,2,4}, {2,2,2,5}, {2,2,2,6}, {2,2,2,7}}, //7
    {{0,0,0,3}, {0,0,0,2}, {0,0,2,3}, {0,3}, {0,0,0,7}, {0,0,0,6}, {0,0,0,2,3,3,3,5}, {0,0,0,3,3,3,3,4}}, //8
    {{0,0,0,2}, {0,0,1,2}, {0,2}, {0,0,2,3}, {0,0,0,6}, {0,0,1,6}, {0,0,0,2,2,2,2,4}, {0,0,0,2,3,3,3,5}}, //9
    {{0,0,1,2}, {1,1,1,3}, {0,1,2,2}, {0,2}, {0,0,1,6}, {1,1,1,7}, {1,1,1,2,2,2,3,4}, {0,0,0,2,2,2,2,4}}, //10
    {{1,1,1,3}, {1,1,1,2}, {1,2}, {0,1,2,2}, {1,1,1,7}, {1,1,1,6}, {1,1,1,2,2,2,2,5}, {1,1,1,2,2,2,3,4}}, //11
    {{0,3}, {0,0,2,3}, {1,3,3,3}, {0,3,3,3}, {0,0,0,3,3,3,3,4}, {0,0,0,2,3,3,3,5}, {3,3,3,5}, {3,3,3,4}}, //12
    {{0,0,2,3}, {0,2}, {0,2,2,3}, {1,3,3,3}, {0,0,0,2,3,3,3,5}, {0,0,0,2,2,2,2,4}, {2,2,3,4}, {3,3,3,5}}, //13
    {{0,2}, {0,1,2,2}, {0,2,2,2}, {0,2,2,3}, {0,0,0,2,2,2,2,4}, {1,1,1,2,2,2,3,4}, {2,2,2,4}, {2,2,3,4}}, //14
    {{0,1,2,2}, {1,2}, {1,2,2,2}, {0,2,2,2}, {1,1,1,2,2,2,3,4}, {1,1,1,2,2,2,2,5}, {2,2,2,5}, {2,2,2,4}}, //15
    {{0,0,0,3,3,3,3,4}, {0,0,0,2,3,3,3,5}, {3,3,3,5}, {3,3,3,4}, {0,0,0,7}, {0,0,0,6}, {0,3,4,6}, {3,4}}, //16
    {{0,0,0,2,3,3,3,5}, {0,0,0,2,2,2,2,4}, {2,2,3,4}, {3,3,3,5}, {0,0,0,6}, {0,0,1,6}, {2,4}, {0,3,4,6}}, //17
    {{0,0,0,2,2,2,2,4}, {1,1,1,2,2,2,3,4}, {2,2,2,4}, {2,2,3,4}, {0,0,1,6}, {1,1,1,7}, {1,2,4,6}, {2,4}}, //18
    {{1,1,1,2,2,2,3,4}, {1,1,1,2,2,2,2,5}, {2,2,2,5}, {2,2,2,4}, {1,1,1,7}, {1,1,1,6}, {2,5}, {1,2,4,6}}, //19
    {{3,3,3,4}, {3,3,3,5}, {3,3,3,6}, {3,3,3,7}, {3,4}, {0,3,4,6}, {3,3,6,7}, {3,7}}, //20
    {{3,3,3,5}, {2,2,3,4}, {2,2,3,7}, {3,3,3,6}, {0,3,4,6}, {2,4}, {3,6}, {3,3,6,7}}, //21
    {{2,2,3,4}, {2,2,2,4}, {2,2,2,7}, {2,2,3,7}, {2,4}, {1,2,4,6}, {2,2,6,7}, {3,6}}, //22
    {{2,2,2,4}, {2,2,2,5}, {2,2,2,6}, {2,2,2,7}, {1,2,4,6}, {2,5}, {2,6}, {2,2,6,7}}, //23
    {{0,0,0,4}, {0,0,0,5}, {0,0,0,6}, {0,0,0,7}, {0,4}, {0,0,4,5}, {0,3,4,6}, {3,4}}, //24
    {{0,0,0,5}, {0,0,1,5}, {0,0,1,6}, {0,0,0,6}, {0,0,4,5}, {0,5}, {2,4}, {0,3,4,6}}, //25
    {{0,0,1,5}, {1,1,1,4}, {1,1,1,7}, {0,0,1,6}, {0,5}, {1,1,4,5}, {1,2,4,6}, {2,4}}, //26
    {{1,1,1,4}, {1,1,1,5}, {1,1,1,6}, {1,1,1,7}, {1,1,4,5}, {1,5}, {2,5}, {1,2,4,6}}, //27
    {{0,4}, {0,0,4,5}, {0,3,4,6}, {3,4}, {0,4,4,4}, {1,4,4,4}, {2,4,4,7}, {3,4,4,7}}, //28
    {{0,0,4,5}, {0,5}, {2,4}, {0,3,4,6}, {1,4,4,4}, {0,0,0,4,5,5,5,5}, {3,3,3,5,5,5,5,7}, {2,4,4,7}}, //29
    {{0,5}, {1,1,4,5}, {1,2,4,6}, {2,4}, {0,0,0,4,5,5,5,5}, {0,5,5,5}, {3,5,5,6}, {3,3,3,5,5,5,5,7}}, //30
    {{1,1,4,5}, {1,5}, {2,5}, {1,2,4,6}, {0,5,5,5}, {1,5,5,5}, {2,5,5,6}, {3,5,5,6}}, //31
    {{3,4}, {0,3,4,6}, {3,3,6,7}, {3,7}, {3,4,4,7}, {2,4,4,7}, {2,7,7,7}, {3,7,7,7}}, //32
    {{0,3,4,6}, {2,4}, {3,6}, {3,3,6,7}, {2,4,4,7}, {3,3,3,5,5,5,5,7}, {2,2,2,6,7,7,7,7}, {2,7,7,7}}, //33
    {{2,4}, {1,2,4,6}, {2,2,6,7}, {3,6}, {3,3,3,5,5,5,5,7}, {3,5,5,6}, {3,6,6,6}, {2,2,2,6,7,7,7,7}}, //34
    {{1,2,4,6}, {2,5}, {2,6}, {2,2,6,7}, {3,5,5,6}, {2,5,5,6}, {2,6,6,6}, {3,6,6,6}}, //35
    {{1,4,4,4}, {0,0,0,4,5,5,5,5}, {3,3,3,5,5,5,5,7}, {2,4,4,7}, {4,5}, {0,5,5,5}, {3,5,5,6}, {4,6}}, //36
    {{2,4,4,7}, {3,3,3,5,5,5,5,7}, {2,2,2,6,7,7,7,7}, {2,7,7,7}, {4,6}, {3,5,5,6}, {3,6,6,6}, {6,7}}, //37
    {{0,4,4,4}, {1,4,4,4}, {2,4,4,7}, {3,4,4,7}, {4}, {4,5}, {4,6}, {4,7}}, //38
    {{0,5,5,5}, {1,5,5,5}, {2,5,5,6}, {3,5,5,6}, {4,5}, {5}, {5,6}, {4,6}}, //39
    {{3,4,4,7}, {2,4,4,7}, {2,7,7,7}, {3,7,7,7}, {4,7}, {4,6}, {6,7}, {7}}, //40
    {{3,5,5,6}, {2,5,5,6}, {2,6,6,6}, {3,6,6,6}, {4,6}, {5,6}, {6}, {6,7}}  //41
};

}

#endif // CINO_SUBDIVISION_LEGACY_HEXA_SCHEMAS_H
